<template>
  <el-table
      :data="tableDataAgree.filter(data => !search || data.name.toLowerCase().includes(search.toLowerCase()))"
      :default-sort = "{prop: 'credit', order: 'descending'}"
      tooltip-effect="dark"
      style="width: 100%"
      @selection-change="handleSelectionChange">
    <el-table-column label="学分详情">
      <el-table-column
          label="总学分"
          sortable
          prop="after_changeCre">
      </el-table-column>
      <el-table-column label="学分变化" prop="creditNumber">
      </el-table-column>
      <el-table-column label="申请理由" prop="reason">
      </el-table-column>
      <el-table-column label="申请凭证" prop="pic_path">
        <template #default="scope">
          <el-image  :src="url+scope.row.pic_path" min-width="70" height="70" alt="" :preview-src-list="url+scope.row.pic_path"></el-image>
          <!--            v-for="item in scope.row.pic_path.split(',')" v-if="item ? item : '' "-->
        </template>
      </el-table-column>
      <el-table-column label="申请时间" prop="apply_Time">
      </el-table-column>
      <el-table-column label="审批时间" prop="judge_Time">
      </el-table-column>
      <el-table-column label="状态" prop="state">
        <template #default="scope">
            <span v-if="scope.row.state===0">
              <i class="el-icon-info" style="color: #ccec5b" aria-hidden="true"></i>
            </span>
          <span v-if="scope.row.state===1">
              <i class="el-icon-success" style="color: #39cf7c" aria-hidden="true"></i>
            </span>
          <span v-if="scope.row.state===2">
              <i class="el-icon-error" style="color: #ED3F14" aria-hidden="true"></i>
            </span>
          <span :style="{ color: scope.row.state === 1 ? '#39cf7c' :scope.row.state === 0 ? '#ccec5b':'#ED3F14' }">{{ scope.row.state === 1 ? '已通过' :scope.row.state === 0 ? '待审批':'未通过' }}</span>
        </template>
      </el-table-column>
<!--      <el-table-column>-->
<!--        <template #header>-->
<!--          <el-input-->
<!--              v-model="search"-->
<!--              size="mini"-->
<!--              placeholder="输入关键字搜索"/>-->
<!--        </template>-->
<!--      </el-table-column>-->
    </el-table-column>



  </el-table>
<!--  <el-pagination-->
<!--      background-->
<!--      @size-change="handleSizeChange"-->
<!--      @current-change="handleCurrentChange"-->
<!--      :current-page="currentPage"-->
<!--      :page-sizes="[5,10,15]"-->
<!--      :page-size="pagesize"-->
<!--      layout="total,jumper,prev, pager, next,sizes"-->
<!--      :total="files_count"-->
<!--  ></el-pagination>-->
</template>
<script lang="ts">
import {getCurrentInstance} from "vue";
import {getStudentCreditRecord} from "@/network/student/getStudentCreditRecord";

export default {
  name:'StudentAgreeAllApply',
  data(){
    return{
      tableDataAgree:[],
      search: '',
      url: 'http://localhost:7070'

    }
  },
  setup(){
    const {proxy}:any=getCurrentInstance();
    const id = localStorage.getItem('StudentId')
    getStudentCreditRecord(id).then(result=>{
      console.log(result.data.result)
      // const pic_path=result.data.result.pic_path.split(',')
      // console.log(pic_path)
      proxy.tableDataAgree=result.data.result
    }).catch(err=>{

    })





    return{

    }
  }
}
</script>
